package main

import "fmt"
//import "unicode/utf8"

func funcName(value1 int, value2 int) (output1 int, output2 int) {
    //这里是处理逻辑代码
    //返回多个值
    return value1, value2
}

func main()  {
	//if语句的使用
	var a int = 10
	var b int = 20
	if a > b {
		fmt.Println("a > b")
	}else{
		fmt.Println("a < b")
	}

	if a == 10 {
		fmt.Println("The integer is equal to 10")
	} else if a < 10 {
		fmt.Println("The integer is less than 10")
	} else {
		fmt.Println("The integer is greater than 10")
	}

	//goto的使用
	var sum int = 0
	Here:
	if sum < 30{
		sum += 1
		goto Here
	}
	fmt.Println("sum = ", sum)

	//break的使用
	for i := 0; i < 10; i++ {
		if i == 5 {
			break
		}
		fmt.Println(i)
	}

	//丢弃不需要的返回值,例如：只需要获取map中的value值，而不需要key值
	map1 := make(map[string]string)
	map1["Name"] = "Bruce.Yang"
	map1["Work"] = "Engineer"
	map1["Age"] = "30"
	for _, value := range map1 {
		fmt.Printf("Value = %s\n", value)
	}

	//丢弃不需要的返回值,例如：只需要获取函数中的一个返回值，而不需要另一个返回值
	_, value1 := funcName(1, 2)
	fmt.Printf("Value1 = %d\n", value1)

	//switch的使用
	var grade string = "B"
	var marks int = 30
	switch marks {
		case 90: grade = "A"
		case 80: grade = "B"
		case 50,60,70: grade = "C"
		default: grade = "D"
	}
	fmt.Printf("grade = %s\n", grade)
}
